FROM centos

RUN yum install gcc make zlib-devel pcre-devel git wget -y
RUN git clone --depth=1 https://gitee.com/fastdfs100/libfastcommon && \
        cd libfastcommon && \
        sh make.sh && \
        sh make.sh install
RUN wget -O fastdfsV6.07.tar.gz  https://gitee.com/fastdfs100/fastdfs/repository/archive/V6.07?format=tar.gz && \
        tar -xvf fastdfsV6.07.tar.gz && \
        cd fastdfs-V6.07 && \
        sh make.sh && \
        sh make.sh install && \
	cp -vf conf/* /etc/fdfs/

RUN git clone --depth=1 https://gitee.com/fastdfs100/fastdfs-nginx-module 
RUN wget http://nginx.org/download/nginx-1.21.1.tar.gz && \
        tar -xvf nginx-1.21.1.tar.gz && \
        cd nginx-1.21.1 && \
        ./configure --add-module=../fastdfs-nginx-module/src && \
        make && make install && \
	cp -vf ../fastdfs-nginx-module/src/mod_fastdfs.conf /etc/fdfs/
	
COPY nginx.conf /usr/local/nginx/conf/nginx.conf
COPY entrypoint.sh /entrypoint.sh

RUN rm -rf libfastcommon fastdfsV6.07.tar.gz fastdfs-V6.07 fastdfs-nginx-module nginx-1.21.1 nginx-1.21.1.tar.gz && \
	yum remove gcc make git wget -y && \
	yum clean all

ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
